package com.ikun.kunpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ikun.kunpicturebackend.domain.Picture;
import com.ikun.kunpicturebackend.domain.User;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ikun.kunpicturebackend.model.dto.user.UserQueryRequest;
import com.ikun.kunpicturebackend.model.vo.LoginUserVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author 32144
* @description 针对表【user(用户表)】的数据库操作Service
* @createDate 2025-09-21 17:20:17
*/
public interface UserService extends IService<User> {

    /**
     * 用户注册
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @param checkPassword 确认密码
     * @return 用户id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 用户登录
     * @param userAccount 用户账号
     * @param userPassword 用户密码
     * @param request
     * @return 脱敏后的用户信息
     */
    LoginUserVO userLogin(String userAccount, String userPassword, HttpServletRequest request);

    /**
     * 获取登录用户信息
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 用户注销
     * @param request
     * @return
     */
    Boolean userLogOut(HttpServletRequest request);

    /**
     * 密码加密
     * @param password 密码
     * @return 加密密码
     */
    String getEncryptPassword(String password);

    /**
     * 构造QueryWrapper
     * @param request
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest request);

    /**
     * 判断是否是管理员
     * @param user
     * @return
     */
    boolean isAdmin(User user);


}
